﻿/**********************************************************************
 * @file   FITKAcousticsGourpDataAdaptor.h
 * @brief  分组信息读写出适配器 
 * @author yangjing (1195810980@qq.com)
 * @date   2025-02-25
 *********************************************************************/
#ifndef _FITK_ACOUSTICS_GOURP_DATA_ADAPTOR_H__
#define _FITK_ACOUSTICS_GOURP_DATA_ADAPTOR_H__

#include "FITKAcousticsAbstractAdaptor.h" 
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"
#include <H5Cpp.h>
namespace Acoustics {
    class FITKAcousticsGroupManager;
    class FITKAcousticsGroupData;
}
namespace IO {
    class FITKHDF5FileTool;
}
namespace IO 
{
    /**
     * @brief 几何信息写出适配器
     * @author LiBaojun (libaojunqd@foxmail.com)
     * @date 2025-02-19
     */
    class FITKAcousticsGourpDataAdaptor : public FITKAcousticsAbsAdaptor
    {

    public:
        /**
         * @brief Construct a new FITKAcousticsGourpDataAdaptor object
         * @author yangjing (1195810980@qq.com)
         * @date 2025-02-24
         */
        explicit FITKAcousticsGourpDataAdaptor() = default;
        /**
         * @brief Destroy the FITKAcousticsGourpDataAdaptor object
         * @author yangjing (1195810980@qq.com)
         * @date 2025-02-24
         */
        virtual ~FITKAcousticsGourpDataAdaptor() = default;
        /**
         * @brief 执行读取
         * @return true 
         * @return false 
         * @author yangjing (1195810980@qq.com)
         * @date 2025-02-24
         */
        virtual bool adaptR() override;
        /**
         * @brief 执行写出
         * @return true 
         * @return false 
         * @author yangjing (1195810980@qq.com)
         * @date 2025-02-24
         */
        virtual bool adaptW() override;
 
    private:
        /**
         * @brief 执行写出父类信息
         * @return true
         * @return false
         * @author yangjing (1195810980@qq.com)
         * @date 2025-02-24
         */
        bool writeParent(Acoustics::FITKAcousticsGroupData*GroupData , H5::Group &gp);


        /**
         * @brief 执行读入父类信息
         * @return true
         * @return false
         * @author yangjing (1195810980@qq.com)
         * @date 2025-02-24
         */
        bool readParent(Acoustics::FITKAcousticsGroupData*GroupData, H5::Group &gp);
    private:
        Acoustics::FITKAcousticsGroupManager*m_GroupManager = nullptr;
        IO::FITKHDF5FileTool*m_toolp{ nullptr };
    };
    Register2FITKIOAdaptorFactory(FITKAcousticsHDF5, Acoustics::FITKAcousticsGroupManager, FITKAcousticsGourpDataAdaptor);
}

#endif